﻿<?xml version="1.0" encoding="utf-8"?>
<UserControl
	x:Class="Debugger.AddIn.Pads.ParallelPad.ThreadStack" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	Width="Auto"
	Height="Auto"
	Background="Transparent">
	<UserControl.Resources>
		<LinearGradientBrush x:Key="RowBackground" StartPoint="0.5,0" EndPoint="0.5,1">
			<GradientStop Color="#F7F7F7" Offset="0.2"/>
			<GradientStop Color="#EAEAEA" Offset=".5"/>
			<GradientStop Color="#E5E5E5" Offset=".8"/>
		</LinearGradientBrush>
	</UserControl.Resources>
	<Border
		x:Name="BorderParent"
		BorderBrush="Black"
		BorderThickness="3"
		CornerRadius="5"
		Height="Auto">
		<StackPanel
			Background="Transparent"
			Margin="-5">
			<Border
				Height="23"
				Margin="5,5,5,0"
				CornerRadius="5,5,0,0"
				BorderBrush="Transparent">
				<Border.Background>
					<LinearGradientBrush
						StartPoint="0,0.5"
						EndPoint="1,0.5">
						<GradientStop
							Color="#FFE2F6FE"
							Offset="0" />
						<GradientStop
							Color="White"
							Offset="1" />
					</LinearGradientBrush>
				</Border.Background>
				<TextBlock
					VerticalAlignment="Center"
					x:Name="HeaderText"
					FontFamily="Khmer UI"
					FontSize="12"
					Margin="2"
					HorizontalAlignment="Center" />
			</Border>
			<DataGrid
				Background="Transparent"
				Margin="5,0,5,5"
				x:Name="datagrid"
				VerticalScrollBarVisibility="Disabled"
				HorizontalScrollBarVisibility="Disabled"
				GridLinesVisibility="None"
				RowHeight="18"
				SelectionMode="Single"
				SelectionUnit="FullRow"
				ItemsSource="{Binding}"
				AutoGenerateColumns="False"
				CanUserAddRows="False"
				HeadersVisibility="None"
				BorderThickness="0"
				MouseDoubleClick="Datagrid_MouseDoubleClick"
				MouseRightButtonUp="Datagrid_MouseRightButtonUp">
				<DataGrid.CellStyle>
					<Style
						TargetType="{x:Type DataGridCell}">
						<Setter Property="Background" Value="White"/>
						<Setter
							Property="Focusable"
							Value="false" />
						<Setter
							Property="BorderThickness"
							Value="0" />
						<Style.Triggers>
							<Trigger
								Property="IsSelected"
								Value="True">
								<!-- disable selection highlight -->
								<Setter
									Property="Foreground"
									Value="Black" />
								<Setter
									Property="Background"
									Value="{x:Null}" />
							</Trigger>
						</Style.Triggers>
					</Style>
				</DataGrid.CellStyle>
				<DataGrid.RowStyle>
					<Style TargetType="{x:Type DataGridRow}">
						<Setter Property="Background" Value="White"></Setter>
						<Style.Triggers>
							<Trigger Property="IsMouseOver" Value="True">
								<Setter Property="Background" Value="{StaticResource RowBackground}" />
							</Trigger>
						</Style.Triggers>
					</Style>
				</DataGrid.RowStyle>
				<DataGrid.Columns>
					<DataGridTemplateColumn>
						<DataGridTemplateColumn.CellTemplate>
							<DataTemplate>
								<Border BorderBrush="Gray" BorderThickness="0,1,1,0" Width="25" Height="22">
									<Image VerticalAlignment="Center" Margin="0,-5,0,0" Width="14" Height="14" HorizontalAlignment="Center"
									       Source="{Binding Image}" />
								</Border>
							</DataTemplate>
						</DataGridTemplateColumn.CellTemplate>
					</DataGridTemplateColumn>
					<DataGridTemplateColumn
						Width="Auto">
						<DataGridTemplateColumn.CellTemplate>
							<DataTemplate>
								<Border BorderBrush="Gray" BorderThickness="0,1,0,0">
									<TextBlock Margin="5,0,10,0"
									           VerticalAlignment="Center"
									           FontFamily="Khmer UI"
									           FontSize="12"
									           Text="{Binding Path=MethodName}"
									           FontWeight="{Binding Path=FontWeight}"
									           Foreground="{Binding Path=Foreground}"
									/>
								</Border>
							</DataTemplate>
						</DataGridTemplateColumn.CellTemplate>
					</DataGridTemplateColumn>
				</DataGrid.Columns>
			</DataGrid>
		</StackPanel>
	</Border>
</UserControl>